/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				WoodCondition
 
Function						: 				Provides a class for holding 
												the wood condition class
****************************************************************************/
package planninglanguage.softconditions;

import mre.MRE;
import base.WargusGameState;


public class RelativeWoodSoftCondition extends SoftCondition {
	int m_minWood;
	int m_initialWood;
	
	public RelativeWoodSoftCondition(int a_minWood,int a_initialWood)
	{
		m_minWood = a_minWood;
		m_initialWood = a_minWood;
	}
	
	public String toString(int tabs) {
	  String n = super.toString(tabs);
	  n = n + "Min Wood is :" + m_minWood + "\n";
	  n = n + "Initial Wood is :" + m_initialWood;	  
	  return n;
	}	
	public float test(WargusGameState a_gameState)
	{
		if (a_gameState.getPlayer().getWood()-(MRE.allocated_wood+m_initialWood) >= m_minWood) {
			return 1.0f;
		} else {
			int progress = a_gameState.getPlayer().getWood()-(MRE.allocated_wood+m_initialWood);
			if (progress<0) progress=0;
			return ((float)progress)/((float)m_minWood);
		} // if			
	}
	
}
